package com.lnsf.bookstore.web.cart.service.impl;

import com.lnsf.bookstore.web.cart.dao.ApiCartMapper;
import com.lnsf.bookstore.web.cart.service.ApiCartService;
import com.lnsf.bookstore.web.cart.vo.ApiCart;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


@Service
public class ApiCartServiceImpl implements ApiCartService {
    @Autowired
    private ApiCartMapper apiCartMapper;

    @Override
    public void updateCheck(String[] bookIds, Integer isChecked, Integer userId) {
        apiCartMapper.updateCheck(bookIds,isChecked,userId);
    }

    @Override
    public void save(ApiCart apiCart) {
        apiCartMapper.insertSelective(apiCart);
    }

    @Override
    public void deleteByUserAndBookIds(Integer userId, int[] bookIds) {
        apiCartMapper.deleteByUserAndBookIds(userId,bookIds);
    }

    @Override
    public void update(ApiCart apiCart) {
        apiCartMapper.updateByPrimaryKeySelective(apiCart);
    }

    @Override
    public void delete(Integer id) {
        apiCartMapper.delete(id);
    }

    @Override
    public ApiCart queryObject(Integer id) {
        return apiCartMapper.queryObject(id);
    }

    @Override
    public List<ApiCart> queryList(Map<String, Object> map) {
        return apiCartMapper.queryList(map);
    }
}
